{% extends 'admin_base.html' %}
{% load i18n %}
{% load crispy_forms_tags %}

{% block actions %}
{% if object.termination_date is None %}
<a href="{% url 'people:terminate' object.id %}" class="btn">{% translate "Terminate" %}</a>
{% else %}
<a href="{% url 'people:offboarding-detail' object.id %}" class="btn">{% translate "See offboarding track" %}</a>
{% endif %}

<a href="{% url 'people:colleague_access' object.id %}" class="btn">{% translate "Access" %}</a>
<a href="{% url 'people:delete' object.id %}" class="btn btn-danger">{% translate "Delete" %}</a>
{% endblock %}

{% block content %}
<div class="row">
  <div class="col-7">
    <div class="card mt-3">
      <div class="card-header">
        <h3 class="card-title">{% translate "Colleague" %}</h3>
      </div>
      <div class="card-body">
        {% crispy form %}
      </div>
    </div>
  </div>
  <div class="col-5">
    <div class="card mt-3">
      <div class="card-header">
        <h3 class="card-title">{% translate "Resources available" %}</h3>
      </div>
      <div class="list-group list-group-flush">
        {% for resource in object.resources.all %}
        <div class="list-group-item">
          <div class="row align-items-center">
            <div class="col text-truncate">
              <span class="text-body d-block">{{ resource.name }}</span>
            </div>
          </div>
        </div>
        {% empty %}
        <div class="list-group-item">
          <div class="row align-items-center">
            <div class="col text-truncate">
              {% translate "No resources are available to this user yet" %}
            </div>
          </div>
        </div>
        {% endfor %}
      </div>
      <div class="card-footer">
        <a href="{% url 'people:add_resource' object.id %}" class="btn btn-primary">
          {% translate "Change" %}
        </a>
      </div>
    </div>
    <div class="card mt-3">
      <div class="card-header">
        <h3 class="card-title">{% translate "Hardware" %}</h3>
      </div>
      <div class="list-group list-group-flush">
        {% for hardware in object.hardware.all %}
        <div class="list-group-item">
          <div class="row align-items-center">
            <div class="col text-truncate">
              <span class="text-body d-block">{{ hardware.name }}</span>
            </div>
          </div>
        </div>
        {% empty %}
        <div class="list-group-item">
          <div class="row align-items-center">
            <div class="col text-truncate">
              {% translate "No hardware assigned to this user yet" %}
            </div>
          </div>
        </div>
        {% endfor %}
      </div>
      <div class="card-footer">
        <a href="{% url 'people:add_hardware' object.id %}" class="btn btn-primary">
          {% translate "Change" %}
        </a>
      </div>
    </div>
  </div>
</div>
{% endblock %}

